import Dialog from '@vant/weapp/dialog/dialog';

Component({
  properties: {
    status: String,
    isDetail: Boolean,
  },
  data: {
    btnConfig: [{
      title: '分配科室',
      btnKey: 'pending_department',
      color: '#2abb89',
      show: 'Pending_Department',// 待分配科室
      icon: 'icon-keshi'
    }, {
      title: '科室确认',
      btnKey: 'confirm_department',
      color: '#2abb89',
      show: 'Confirmed',// 待确认
      icon: 'icon-queren1'
    }, {
      title: '患者备注',
      btnKey: 'patient_remark',
      color: '#9e9e9e',
      show: 'Confirm_Passage',// 确认通过
      icon: 'icon-beizhu'
    }, {
      title: '联系患者',
      btnKey: 'contact_patient',
      color: '#2abb89',
      show: 'Confirm_Passage', //确认通过
      icon: 'icon-lianxihuanzhe'
    }, {
      title: '患者备注',
      btnKey: 'patient_remark',
      color: '#9e9e9e',
      show: 'Contacted',// 已就诊
      icon: 'icon-fankuizhongxinoff',
    }, {
      title: '确认住院',
      btnKey: 'confirm_inHospital',
      color: '#2abb89',
      show: 'Contacted',// 已联系
      icon: 'icon-queren'
    }, {
      title: '确认就诊',
      btnKey: 'confirm_seedoctor',
      color: '#2abb89',
      show: 'Contacted',// 已联系
      icon: 'icon-zhiliao'
    }, {
      title: '诊疗结束',
      btnKey: 'treat_end',
      color: '#9e9e9e',
      show: 'Already_Visited',// 已就诊
      icon: 'icon-jieshu'
    }, {
      title: '确认就诊',
      btnKey: 'confirm_seedoctor',
      color: '#2abb89',
      show: 'Already_Visited',// 已就诊
      icon: 'icon-zhiliao'
    }, {
      title: '确认住院',
      btnKey: 'confirm_inHospital',
      color: '#2abb89',
      show: 'Already_Visited',// 已就诊
      icon: 'icon-zhuyuan'
    }, {
      title: '入院备注',
      btnKey: 'inHospital_remark',
      color: '#9e9e9e',
      show: 'Already_Hospitalized',// 已住院
      icon: 'icon-beizhu'
    }, {
      title: '患者出院',
      btnKey: 'patient_outHospital',
      color: '#2abb89',
      show: 'Already_Hospitalized',// 已住院
      icon: 'icon-huanzhe'
    }, {
      title: '诊疗结束',
      btnKey: 'treat_end',
      color: '#9e9e9e',
      show: 'Discharged', // 已出院
      icon: 'icon-jieshu'
    }, {
      title: '住院反馈',
      btnKey: 'inHospital_feedback',
      color: '#2abb89',
      show: 'Discharged', // 已出院
      icon: 'icon-fankuizhongxinoff'
    }]
  },

  methods: {
    onBtnClick(e) {
      const { isDetail } = this.data;
      const { currentTarget: { dataset: { btnkey } } } = e;
      switch (btnkey) {
        case "pending_department"://分配科室
          this.triggerEvent('searchShow');
          break;
        case 'confirm_department'://科室确认
          isDetail ? this.confirmDepartment():
          this.triggerEvent('confirmDepartment');
          break;
        case 'contact_patient'://联系患者
          isDetail ? this.contactPatient():
          this.triggerEvent('contactPatient');
          break;
        case 'confirm_inHospital'://确认住院
          isDetail ? this.confirmInHospital():
          this.triggerEvent('confirmInHospital');
          break;
        case 'confirm_seedoctor'://确认就诊
          isDetail ? this.confirmSeedoctor():
          this.triggerEvent('confirmSeedoctor');
          break;
        case 'treat_end'://诊疗结束
          isDetail ? this.treatEnd():
          this.triggerEvent('treatEnd');
          break;
        case 'patient_outHospital'://患者出院
          isDetail ? this.patientOutHospital():
          this.triggerEvent('patientOutHospital');
          break;
        case 'patient_remark': //患者备注
          this.triggerEvent('remarkShow');
        break;
      }
    },
    confirmDepartment() {
      Dialog.confirm({
        context: this,
        title: '确定该患者转入本科室吗？',
      })
        .then(() => {
          // on confirm
        })
    },
    contactPatient() {
      Dialog.confirm({
        context: this,
        title: '确定已联系该患者了吗？',
      })
        .then(() => {
          // on confirm
        })
    },
    confirmInHospital() {
      Dialog.confirm({
        title: '确定该患者已住院吗？',
      })
        .then(() => {
          // on confirm
        })
    },
    patientOutHospital() {
      Dialog.confirm({
        title: '确定该患者已出院吗？',
      })
        .then(() => {
          // on confirm
        })
    },
    confirmSeedoctor() {
      Dialog.confirm({
        title: '确定该患者已来院就诊吗？',
      })
        .then(() => {
          // on confirm
        })
    },
    treatEnd() {
      Dialog.confirm({
        title: '确定本次诊疗已经结束了吗？',
      })
        .then(() => {
          // on confirm
        })
    },
  }
})